<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('考试列表')" />
</head>
<body class="gray-bg">
    <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="notice-form">
					<div class="select-list">
						<ul>
							<li>
								考试名称：<input type="text" name="title" autocomplete="off"/>
							</li>							
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <!-- <div class="btn-group-sm" id="toolbar" role="group">
		        <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="exam:exam:add">
		            <i class="fa fa-plus"></i> 新增
		        </a>
		        <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="exam:exam:edit">
		            <i class="fa fa-edit"></i> 修改
		        </a> 
		        <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="exam:exam:remove">
		            <i class="fa fa-remove"></i> 删除
		        </a>
	        </div> -->
	        
	        <div class="col-sm-12 select-table table-striped">
	            <table id="bootstrap-table"></table>
	        </div>
    	</div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('exam:myExam:edit')}]];
        var removeFlag = [[${@permission.hasPermi('exam:myExam:remove')}]];
        var prefix = ctx + "exam/myExam";
        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "考试列表",
                showSearch: false,
                showRefresh: false,
                showColumns: false,
                showToggle:  false,
                columns: [
				{
					field : 'id', 
					title : 'id',
					visible: false
				},
				{
					field : 'title', 
					title : '考试名称',
				},
				{
					field : 'userScore', 
					title : '考试得分'
					
				},
				{
					field : 'userTime', 
					title : '考试用时(分钟)',
					formatter: function(value, row, index) {
						return Math.ceil(value/60);
					}
				},
				{
					field : 'createTime', 
					title : '考试时间',
				},
				{
					field : 'qualifyScore', 
					title : '是否通过',
					formatter: function(value, row, index) {
						if(row.userScore >= value){
							return '<span class="badge badge-primary">通过</span>';
						}
						return '<span class="badge badge-danger">未通过</span>';
					}
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-warning btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-search"></i>考试明细</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
       function detail(id){
    	   var url = "exam/examOnline/paperResult/"+id;
    	   $.modal.openTab("考试明细", url);
       }
    </script>
</body>
</html>